/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package classcreator.classfillers;

import classcreator.abstractclasses.AbstractProperty;
import classcreator.abstractclasses.EnumDataType;

/**
 *
 * @author Samus
 */
public class Sorters {

    private static Sorters instance = new Sorters();

    public static Sorters getInstance() {
        return instance;
    }

    private Sorters() {
    }

    public String propSort(EnumDataType type) {
        String res = "";
        if (type == EnumDataType.BOOLEAN) {
            res = "boolean ";
        } else if (type == EnumDataType.COLLECTION) {
            res = "List ";
        } else if (type == EnumDataType.INT) {
            res = "int ";
        } else {
            res = "String ";
        }
        return res;
    }

    public String propSortSent(AbstractProperty prop) {
        String res = "";
        if (prop.getType() == EnumDataType.BOOLEAN) {
            res = "boolean";
        } else if (prop.getType() == EnumDataType.INT) {
            res = "int(10)";
        } else if (prop.getType() == EnumDataType.STRING) {
            res = "varchar(50)";
        }
        return res;
    }

    public EnumDataType reversePropSort(String prop) {
        EnumDataType type = null;
        if (prop.equals("String")) {
            type = EnumDataType.STRING;
        } else if (prop.equals("Collection")) {
            type = EnumDataType.COLLECTION;
        } else if (prop.equals("Int")) {
            type = EnumDataType.INT;
        } else if (prop.equals("Boolean")) {
            type = EnumDataType.BOOLEAN;
        }
        return type;
    }
}
